package com.zrgk.controller;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zrgk.bean.ConContentBean;
import com.zrgk.bean.ConPlanBean;
import com.zrgk.service.ConPlanService;

@Controller
@RequestMapping(value= "/conContentPlan.do")
public class ConPlanController {
	@Autowired
	@Qualifier(value = "conPlanService")
	private ConPlanService conPlanService;

	@RequestMapping(params = "method=list")
	public String listConPlan(HttpServletRequest request) {
		// PageHelper.orderBy("age desc");
		// 设置分页信息
		Page<ConPlanBean> page = PageHelper.startPage(1, 5);
		List<ConPlanBean> conPlan = conPlanService.listConPlan();
		request.setAttribute("conPlan", conPlan);
		for (ConPlanBean conp : conPlan) {
			System.out.println(conPlan);
		}
		System.out.println("abc");
		return "/html/resource/customer/resource/list.jsp";
	}
	
	@RequestMapping(params = "method=insert")
	public String insertConPlan() {
		ConPlanBean conp = new ConPlanBean();
	    conp.setPlanNo("001");
	    Date finishDate  = new Date();
	    conp.setFinishDate(finishDate);        

	    conPlanService.insertConPlan(conp);
	    	    
		return "/html/resource/customer/develop/list.jsp";
	}

	public ConPlanService getConPlanService() {
		return conPlanService;
	}

	public void setConPlanService(ConPlanService conPlanService) {
		this.conPlanService = conPlanService;
	}

}
